# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=plasma-desktop
pkgver=6.0.4
pkgrel=0
pkgdesc="KDE Plasma Desktop"
# armhf blocked by qt6-qtdeclarative
# ppc64le, s390x and riscv64 blocked by qt6-qtwebengine -> kaccounts-integration
arch="all !armhf !ppc64le !s390x !riscv64"
url='https://kde.org/plasma-desktop/'
license="GPL-2.0-only AND LGPL-2.1-only"
depends="
	accountsservice
	font-noto-emoji
	ibus-emoji
	kirigami
	kirigami-addons
	plasma-workspace
	qqc2-desktop-style
	setxkbmap
	xdg-user-dirs
	"
makedepends="
	attica-dev
	baloo-dev
	eudev-dev
	extra-cmake-modules
	fontconfig-dev
	ibus-dev
	kauth-dev
	kcmutils-dev
	kcodecs-dev
	kconfig-dev
	kdbusaddons-dev
	kdeclarative-dev
	kdoctools-dev
	kglobalaccel-dev
	ki18n-dev
	kitemmodels-dev
	knewstuff-dev
	knotifications-dev
	knotifyconfig-dev
	kpeople-dev
	kpipewire-dev
	krunner-dev
	kwallet-dev
	kwin-dev
	libplasma-dev
	libxcursor-dev
	libxi-dev
	libxkbfile-dev
	plasma-activities-stats-dev
	plasma-workspace-dev
	plasma5support-dev
	qqc2-desktop-style-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qtsvg-dev
	samurai
	signon-plugin-oauth2-dev
	xf86-input-evdev-dev
	xf86-input-libinput-dev
	xf86-input-synaptics-dev
	xkeyboard-config-dev
	"
checkdepends="
	dbus
	iso-codes
	xvfb-run
	"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
subpackages="$pkgname-dbg $pkgname-doc $pkgname-lang knetattach"
_repo_url="https://invent.kde.org/plasma/plasma-desktop.git"
source="https://download.kde.org/stable/plasma/$pkgver/plasma-desktop-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# kcm-keyboard-keyboard_memory_persister_test is broken
	dbus-run-session -- xvfb-run ctest --test-dir build --output-on-failure -E "(positioner|kcm-keyboard-keyboard_memory_persister_)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

knetattach() {
	pkgdesc="Wizard which makes it easier to integrate network resources with the Plasma Desktop"
	depends=""

	amove usr/bin/knetattach
	amove usr/share/applications/org.kde.knetattach.desktop
}

sha512sums="
6e682e2ff91bda05331f581a36afbf1ea571c8855a27280d871e0ae1cd570373f5bb781d078c010d8cf74da0f062deabd9186b161a08a3178304ea6c50816860  plasma-desktop-6.0.4.tar.xz
"
